
import cn.itrip.beans.pojo.ItripHotelTempStore;
import cn.itrip.dao.mapper.ItripHotelTempStoreMapper;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
import java.io.InputStream;
public class hjltext {
    private SqlSession session=null;
    @Before
    public void before() throws IOException {
        //1 加载配置文件
        InputStream in= Resources.getResourceAsStream("mybatis.xml");
        //2 获取连接数据库的对象  会话 session
        SqlSessionFactoryBuilder ssfb=new SqlSessionFactoryBuilder();
        SqlSessionFactory ssf=ssfb.build(in);
        session=ssf.openSession();
    }

    @Test
    public void text2() {
        ItripHotelTempStoreMapper itripHotelTempStoreMapper = session.getMapper(ItripHotelTempStoreMapper.class);
        ItripHotelTempStore itripHotelTempStore = new ItripHotelTempStore();
      //  itripHotelTempStore.setModifyDate(new Date());
        itripHotelTempStore.setHotelId(44);
        int i= itripHotelTempStoreMapper.updateByHotelId(itripHotelTempStore);
        session.commit();
        System.out.println(i);
        //AppInfo list = appInfoMapper.selectById(58);
        //System.out.println(list);
    }
    @After
    public void after(){
        //5 释放资源
        //session.close();
    }

}
